<?php


namespace app\api\controller\v1;


class Img
{
    /**
     * 获取图片地址列表
     * @auth('用户商家','用户商家管理')
     */
    public function getImgUrlAll()
    {
        $path = config('setting.xd_prefix');
        $data = scandir($path);
        $arr = [];
        foreach ($data as $value){
            if($value != '.' && $value != '..'){
                $data_one = scandir($path.'/'.$value);
                foreach ($data_one as $v){
                    if($v != '.' && $v != '..') {
                        $data_two = explode('.',$v);
                        array_push($arr, ['path'=>$value.'/'.$v,'url'=>config('setting.img_prefix').$value.'/'.$v,'name' => $v, 'extension' => '.'.$data_two[1], 'md5'=> md5($data_two[0])]);
                    }
                }
            }
        }
        return $arr;
    }
}